#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
class Person
{
public:
	string name;
	int age;
	
	Person(string name, int age)
	{
		this->name = name;
		this->age = age;
	}
};

void test1()
{
	vector<Person> v;
	Person p1("aaa", 10);
	Person p2("bbb", 20);
	Person p3("ccc", 30);
	
	v.push_back(p1);
	v.push_back(p2);
	v.push_back(p3);
	
	for (vector<Person>::iterator it = v.begin(); it != v.end(); it++)
	{
		cout << "name:" << it->name << "\tage:" << (*it).age << endl;
	}
}

void test2()
{
	vector<Person*> v;
	Person p1("aaa", 10);
	Person p2("bbb", 20);
	Person p3("ccc", 30);
	
	v.push_back(&p1);
	v.push_back(&p2);
	v.push_back(&p3);
	
	for (vector<Person*>::iterator it = v.begin(); it != v.end(); it++)
	{
		cout << "name:" << (*it)->name << "\tage:" << (*it)->age << endl;
	}
}

int main()
{
	test1();
	test2();
	return 0;
}
